using System.Collections.Generic;
using System.Linq;
using SalesPoint.Model;
using Xtensive.Orm;

namespace SalesPoint.ViewModels
{
  public class ProductItemViewModel : GenericItemViewModel<Product>
  {
    public IList<Category> Categories { get; private set; }

    public IList<Supplier> Suppliers { get; private set; }

    public ProductItemViewModel(Session session, Product item)
      : base(session, item)
    {
      Categories = Session.Query.All<Category>()
        .OrderBy(c => c.CategoryName)
        .ToList();

      Suppliers = Session.Query.All<Supplier>()
        .OrderBy(s => s.CompanyName)
        .ToList();
    }
  }
}
